clear
banner="▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
██ ▄▀▄ ██ ▄▄▀██ ▄▄▄ ████ ▄▄▄ █▄ ▄██
██ █ █ ██ ▄▄▀██▄▄▄▀▀████ ███ ██ ███
██ ███ ██ ▀▀ ██ ▀▀▀ ████ ▀▀▀ █▀ ▀██
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀"
echo -e "\e[01;37m$banner\e[0m"; sleep 1
echo -e "\e[01;37m PEGANDO SCTOKEN...\e[0m\n"; sleep 1

oi(){
   clear
   echo -e "\e[01;37m$banner\e[0m"; sleep .5
   echo -e "\e[01;37m INICIANDO A FILA DA MERENDA\e[0m\n"; sleep 1
   
   for i in $(seq 3); do
     case $i in
       1) referer="clubefacil.com"; pageid="999534";;
       2) referer=""; pageid="822068";;
       3) referer="wap.oi.com.br"; pageid="651200"
     esac

    OK=$(curl -s e.oi.ddivulga.com/api/v2.1/fetch -H "Origin: http://oi.ddivulga.com" -H "Referer: http://oi.ddivulga.com/" -d "slotId=%5B%7B%22slotId%22%3A%22100%22%2C%22target%22%3A%22%3B%22%7D%2C%7B%22slotId%22%3A%22101%22%2C%22target%22%3A%22%3B%22%7D%2C%7B%22slotId%22%3A%22102%22%2C%22target%22%3A%22%3B%22%7D%2C%7B%22slotId%22%3A%22103%22%2C%22target%22%3A%22%3B%22%7D%2C%7B%22slotId%22%3A%22104%22%2C%22target%22%3A%22%3B%22%7D%2C%7B%22slotId%22%3A%22105%22%2C%22target%22%3A%22%3B%22%7D%2C%7B%22slotId%22%3A%22106%22%2C%22target%22%3A%22%3B%22%7D%2C%7B%22slotId%22%3A%22107%22%2C%22target%22%3A%22%3B%22%7D%2C%7B%22slotId%22%3A%22108%22%2C%22target%22%3A%22%3B%22%7D%2C%7B%22slotId%22%3A%22109%22%2C%22target%22%3A%22%3B%22%7D%5D&pageId=$pageid&insertionId=&insertionUUID=&insertionType=&referer=http%3A%2F%2F$referer%2F&accessPass=$sctoken" | jq '.["100","101","102","103","104","105","106","107","108","109"] | .advId,.impressionEventId' -r | grep [0-9] 2> /dev/null)
      verif=$(wc -l <<< "$OK")
			      case $verif in
						      1) ;;
									*) ADSON+="$OK\n"
			      esac
   done

    linhas=$(echo -e "$ADSON" | wc -l)
			      case $linhas in
			           1) 
			              echo -e "\e[01;33mSEM MERENDA :(\e[0m"
                   ;;
			           *)
                   echo -e "\e[01;37;41m HORA DA MERENDA \e[0m\n"; sleep .5

                   for i in $(seq $(wc -l <<< "$ADSON")); do
			                case $i in
                         '1'|'3'|'5'|'7'|'9'|'11'|'13'|'15'|'17'|'19'|'21'|'23'|'25'|'27'|'29'|'31'|'33'|'35'|'37'|'39')
												          ADV=$(echo -e "$ADSON" | sed -n "$i"p);;
                          '2'|'4'|'6'|'8'|'10'|'12'|'14'|'16'|'18'|'20'|'22'|'24'|'26'|'28'|'30'|'32'|'34'|'36'|'38'|'40')
												          EVENT=$(echo -e "$ADSON" | sed -n "$i"p)
												          echo -e "\e[01;37;41m $ADV \e[0m\e[01;31;47m $EVENT \e[0m"
                                  vzs=999
                                       for i in $(seq $vzs); do
                                           try=$(curl -s e.oi.ddivulga.com/api/clickEvent -H "Origin: http://oi.ddivulga.com" -H "Referer: http://oi.ddivulga.com/" -d "advId=$ADV&eventImpressionId=$EVENT&apass=$sctoken")

                                           verif=$(grep "evtClickId" -o <<< "$try" | wc -l)

                                               case $verif in
                                                    1) echo -e "\e[01;37;41m MERENDA RECEBIDA :) \e[0m - \e[01;37m$i vezes\e[0m";;
                                                    *) echo -e "\e[01;33m PRATO VAZIO :( \e[0m\n"; break
                                               esac
                                               case $i in
                                                  $vzs) echo
                                               esac
                                       done
			                esac
                   done
			      esac
}
sctoken=$(curl -s http://e.oi.ddivulga.com/api/gp -H "Origin: http://oi.ddivulga.com" -d "version=2" | cut -d '"' -f4)

case $(grep '{}' <<< "$sctoken" -c) in
    0) 
      case $(wc -m <<< "$sctoken") in
          87) oi;;
          *) echo -e "\e[01;33m OPS, VEJA SE ESTÁ COM DADOS MOVEIS LIGADOS!\e[0m"; echo -e "\e[01;33m$sctoken\e[0m"; sleep 1
      esac
      ;;
    1) echo -e "\e[01;33m OPS, VEJA SE ESTÁ COM DADOS MOVEIS LIGADOS!\e[0m"; echo -e "\e[01;33m$sctoken\e[0m"; sleep 1
esac